﻿@page
@using CRM.Views.ViewTest
@{

    Info[] TestUrlArray = {
        new Info("首页", "/"),
        new Info("服务遍历", "/api/debug/Services"),
        new Info("传参测试", "/api/Test/param?UserName=1&PassWord=2"),
        new Info("注册", "/reg"),
        new Info("登录su", "/Login?UserName=su&PassWord=123456"),
        new Info("登录admin", "/Login?UserName=admin&PassWord=123456"),
        new Info("检测登录", "/checkLogin"),
        new Info("获取用户信息", "/api/Users/Info"),
        new Info("获取授权信息", "/api/RuleTemplate/GetAuthItems?id=1"),
        new Info("用户策略鉴权", "/api/Test/AuthPolicy"),
        new Info("业务权限鉴权", "/api/Test/AuthPermission"),
        new Info("登出", "/Logout"),
        new Info("NotFound", "/NotFound") };
}
<h2 id="Vs">Loding</h2>
<h3 style="float:left">Name:<span id="Vn"></span></h3><h5 style="float:right">Desc:<span id="Vd"></span></h5>
<h4>URL:<span id="Vu"></span></h4>
<h4><span class="boxout"><span class="boxin">CookieBefore:</span><span class="boxright" id="Vcb"></span></span></h4>
<h4><span class="boxout"><span class="boxin">CookieAfter:</span><span class="boxright" id="Vca"></span></span></h4>
@Html.CheckBox("exp");
@foreach (var item in TestUrlArray)
{
    <button onclick="T(@item)">@item.name</button>
}
@*<component type="typeof(TestInfo)"/>*@
@*@Html.RenderComponentAsync<TestInfo>*@
<br />
<br />
<iframe id="ifr" src="/xxxx" style="width:100%;height:500px">
</iframe>
<style>
    .boxout {
        display: block;
    }
    .boxout span {
        display: block;
        float: left;
    }
    .boxin {
        width: 10%;
        text-align: right;
    }
    .boxright{width:90%}
    h4 {
        width: 100%; /*定义块元素的宽度*/
        white-space: nowrap; /*内容超宽后禁止换行显示*/
        overflow: hidden; /*超出部分隐藏*/
        text-overflow: ellipsis; /*文字超出部分以省略号显示*/
    }
</style>
<script>
    vs = document.getElementById("Vs");
    vn = document.getElementById("Vn");
    vd = document.getElementById("Vd");
    vu = document.getElementById("Vu");
    vcb = document.getElementById("Vcb");
    vca = document.getElementById("Vca");
    ifr = document.getElementById("ifr");
    function ifronload() {
        vu.style.color = "#32CD32";
        vca.style.color = "#32CD32";
        vca.innerText = getCookie();
    }
    if (ifr.attachEvent) {
        ifr.attachEvent("onload", ifronload);
    } else {
        ifr.onload = ifronload;
    }
    function getCookie() {
        return document.cookie;
        //var re = '';
        //if (document.cookie.length) {
        //    var aCookie = document.cookie.split(";");
        //    for (var i = 0; i < aCookie.length; i++) {
        //        var aCrumb = aCookie[i].split("=");
        //        if (aCrumb[0].toString().Trim() == 'order_list') {
        //            continue;
        //        }
        //        re += (aCrumb[0] + " = " + aCrumb[1] + '\n\n');
        //    }
        //}
        //return re;
    }
    function T(n, u, d) {
        vu.style.color = "#FFD700";
        vca.style.color = "#FFD700";
        var c = getCookie();
        vcb.innerText = c;
        vca.innerText = c;
        vn.innerText = n;
        vu.innerText = u;
        vd.innerText = d;
        ifr.src = u;
    }
    function changeTitle(u) {
        ifr = document.getElementById("ifr");
        ifr.src = u;
    }
    vs.innerText = "Test"
</script>
